// C1 E22 ANSWER edition

#include <stdio.h>

#define INTER 10
#define TAB 8

char line[INTER];

int exptab(int pos);
int findblnk(int pos);
int newpos(int pos);
void printl(int pos);

void main()
{
    int c, pos;

    pos = 0;
    while ((c = getchar()) != EOF)
    {
        line[pos] = c;
        if (c == '\t')
            pos = exptab(pos);
        else if (c == '\n')
        {
            printl(pos);
            pos = 0;
        }
        else if (++pos >= INTER)
        {
            pos = findblnk(pos);
            printl(pos);
            pos = newpos(pos);
        }
    }
}

int exptab(int pos)
{
    line[pos] = ' ';
    for (++pos; pos < INTER && pos % TAB != 0; pos++)
        line[pos] = ' ';
    if (pos < INTER)
        return pos;
    else
    {
        printl(pos);
        return 0;
    }
}

void printl(int pos)
{
    int i;

    for (i = 0; i < pos; i++)
        printf("%c", line[i]);
    if (pos > 0)
        putchar('\n');
}

int findblnk(int pos)
{
    while (pos > 0 && line[pos] != ' ')
        --pos;
    if (pos == 0)
        return INTER;
    else
        return pos + 1;
}

int newpos(int pos)
{
    int i, j;

    if (pos <= 0 || pos >= INTER)
        return 0;
    else
    {
        i = 0;
        for (j = pos; j < INTER; j++)
        {
            line[i] = line[j];
            i++;
        }
        return i;
    }
}
